<?php

/**
 * verwaltung actions.
 *
 * @package    adminslittlehelper
 * @subpackage verwaltung
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
 */
class showOverviewAction extends sfAction
{
  /**
   * Executes index action
   *
   */
  public function execute()
  {
	$this->request_id = $this->getRequestParameter('id');
	$this->request_dest = $this->getRequestParameter('dest');
	$this->request_view = $this->getRequestParameter('view');
	$this->request_hid = $this->getRequestParameter('hid');
	$this->request_cid = $this->getRequestParameter('category_id');    
  	
  	$c = new Criteria();
	$c->addAscendingOrderByColumn(StandortPeer::NAME);
  	
  	$this->locations = StandortPeer::doSelect($c);
  	
  	if(!empty($this->request_id)){
	    $c = new Criteria();
		$c->addAscendingOrderByColumn(RechnerPeer::BEZEICHNUNG);
		$c->add(RechnerPeer::STANDORT_ID, $this->getRequestParameter('id'));
	  	
	  	$this->hardwares = RechnerPeer::doSelect($c);
  	}else{
	    $this->selected_location = new Standort();
  	}
  	
  	if(!empty($this->request_hid)){
  		$this->selected_hardware = RechnerPeer::retrieveByPk($this->getRequestParameter('hid'));
  		
  		if($this->getRequestParameter('view') == 'updateSoftware'){
  			$this->installed_software = $this->selected_hardware->getSoftwareByCategoryId($this->getRequestParameter('category_id'), $this->getRequestParameter('hid'));
  			if(empty($this->installed_software)){
  				$this->message = 'Keine installierbare Software vorhanden.';
  			}
  		}
  	}else{
  		$this->selected_hardware = new Rechner();
  	}
  	
  	$this->selected_software = new Software();
  	
  	return sfView::SUCCESS;
  }
}